package cn.zymall.order.controller;

import cn.zymall.common.controller.crud.BaseController;
import cn.zymall.common.model.Comment;
import cn.zymall.common.model.HomeBillboards;
import cn.zymall.order.service.CommentService;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: mall
 * @description: 评论控制器
 * @author: YueNiao
 * @email: 1486617253@qq.com
 * @create: 2020-08-25 10:10
 **/
@RestController
@RequestMapping("comment")
public class CommentController extends BaseController<CommentService, Comment> {
	@Autowired
	CommentService commentService;
	/**
	 * 分页全部查询
	 * @param page
	 * @param rows
	 * @return
	 */
	@GetMapping("/findAll")
	public PageInfo<Comment> findAll(@RequestParam(required = false)@Param("userId") String userId, @Param("status")String status,@Param("page") int page, @Param("rows") int rows){
		return commentService.findAll( userId,status,page, rows);
	}

	/**
	 * 店家查询商铺评论
	 * @param merchantId
	 * @param userId
	 * @param status
	 * @param page
	 * @param rows
	 * @return
	 */
	@GetMapping("/merchantFindAll")
	public PageInfo<Comment> merchantFindAll(@RequestParam(required = false)@Param("merchantId") String merchantId,@RequestParam(required = false)@Param("userId") String userId, @Param("status")String status,@Param("page") int page, @Param("rows") int rows){
		return commentService.merchantFindAll( merchantId,userId,status,page, rows);
	}
	/**
	 * 模糊查询全部
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	@GetMapping("/moFindAll")
	public PageInfo<Comment> moFindAll(@RequestParam(required = false)@Param("userId") String userId,@Param("status")String status,@Param("value")String value,@Param("page") int page, @Param("rows") int rows){
		return commentService.moFindAll( userId,status,value,page, rows);
	}

	/**
	 * 模糊查询店家评论
	 * @param merchantId
	 * @param userId
	 * @param status
	 * @param value
	 * @param page
	 * @param rows
	 * @return
	 */
	@GetMapping("/moMerchantFindAll")
	public PageInfo<Comment> moMerchantFindAll(@RequestParam(required = false)@Param("merchantId") String merchantId,@RequestParam(required = false)@Param("userId") String userId,@Param("status")String status,@Param("value")String value,@Param("page") int page, @Param("rows") int rows){
		return commentService.moMerchantFindAll(merchantId,userId,status,value,page, rows);
	}
}
